<?php

class Slide{
    
    public function get_slides($gender)
    {
		// $id = $this->getCommonPageId($id);
		$page=$_GET['page'];
switch($page) {
	case 'home':
		$page_id = '2';
		break;
	case 'assignment_manager':
		$page_id = '5';
		break;
	case 'classifieds':
		$page_id = '21';
		break;
	case 'universities':
		$page_id = '6';
		break;
	case 'jobs':
		$page_id = '8';
		break;
	case 'technology':
		$page_id = '10';
		break;
	case 'books':
		$page_id = '9';
		break;
	case 'contact_us':
		$page_id = '11';
		break;	
	default:
		$page_id = '1';
		break;
}
		
        if($_GET['page']=='')
		{
		$query = "SELECT r.posttion,r.upload_file,r.url,r.page_id FROM right_ad r INNER JOIN page p ON r.page_id = p.id
		where r.posttion='$gender' and r.page_id='2'  and r.active_status='1'";
		}
		else
		{
			$query = "SELECT r.posttion,r.upload_file,r.url,r.page_id FROM right_ad r INNER JOIN page p ON r.page_id = p.id
		where r.posttion='$gender' and r.page_id='".$page_id."'  and r.active_status='1'";
		}
		
		
		$result = mysql_query($query);
		
		$slides = array();
		while($row = mysql_fetch_assoc($result)){
		/*echo "<pre>";
		print_r($row);
		echo "</pre>";*/
		$slides[] = $row;
  }

    return $slides;

    }

 public function show_slides($gender)
			{
				$files = $this->get_slides($gender);
					
					$file_links = "";
					
					foreach($files as $file){
						$link = str_replace("http://","",$file['url']);
						
					    echo "<pre>";
						echo '<a href="http://'.$link.'" target="_blank"><img src="uploads/'.$file['upload_file'].'"  width="192" height="192" alt="" /><br>';
						
						echo '<table width="150" border="0" cellspacing="0" cellpadding="0" style=" font-family:Tahoma; font-size:12px; color:#333333; line-height:18px;">
												
						</table></a>';
                
                	
					/*	echo ' <div align="center">'.$file['state'].'</div>';
						echo ' <div align="center">'.$file['city'].'</div>';	*/				
				       echo "</pre>";
				   $file_links .= $file;
				
			}
			return $file_links;
			}
    }
	
	 
    $slide = new Slide();

  
    ?>